package com.nbsaas.boot.marketing.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

import java.time.LocalDateTime;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "秒杀活动", model = "秒杀活动")
@Entity
@Table(name = "bs_flash_sale")
@Comment("秒杀活动表")
public class FlashSale extends AbstractEntity {

    @Comment("秒杀活动名称")
    @SearchItem(name = "name", key = "name", label = "秒杀活动名称")
    @FormField(title = "秒杀活动名称", sortNum = "1", grid = true, required = true)
    @Column(length = 200, nullable = false)
    private String name;

    @Comment("活动编码")
    @SearchItem(name = "code", key = "code", label = "活动编码")
    @FormField(title = "活动编码", sortNum = "2", grid = true)
    @Column(length = 50, unique = true)
    private String code;

    @Comment("活动描述")
    @FormField(title = "活动描述", sortNum = "3", type = InputType.textarea, col = 23)
    @Column(columnDefinition = "text")
    private String description;

    @Comment("开始时间")
    @FormField(title = "开始时间", sortNum = "4", grid = true, type = InputType.date)
    private LocalDateTime startTime;

    @Comment("结束时间")
    @FormField(title = "结束时间", sortNum = "5", grid = true, type = InputType.date)
    private LocalDateTime endTime;

    @Comment("状态")
    @SearchItem(name = "status", key = "status", label = "状态")
    @FormField(title = "状态", sortNum = "6", grid = true, type = InputType.select, option = "promotion_status")
    @Column(length = 20)
    private String status;

    @Comment("最大参与人数")
    @FormField(title = "最大参与人数", sortNum = "7", grid = true, type = InputType.el_input_number)
    private Integer maxParticipants;

    @Comment("当前参与人数")
    @FormField(title = "当前参与人数", sortNum = "8", grid = true, type = InputType.el_input_number)
    private Integer currentParticipants;
} 